mybatis-config.xml简单笔记
mybatis-config.xml简单笔记
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="cacheEnabled" value="true"/> <!-- <setting name="enhancementEnabled" value="true"/> --> <!-- <setting name="lazyLoadingEnabled" value="true"/> --> <!-- <setting name="maxRequests" value="32"/> --> <!-- <setting name="maxSessions" value="10"/> --> <!-- <setting name="maxTransactions" value="5"/> --> <!-- <setting name="useStatementNamespaces" value="true"/> --> <!-- <setting name="lazyLoadingEnabled" value="true"/>--> <!-- <setting name="aggressiveLazyLoading" value="false"/>--> </settings> <typeAliases> <typeAlias type="net.crm.user.model.UserAccount" alias="UserAccount" /> <typeAlias type="net.crm.sys.model.FilesInfo" alias="FilesInfo" /> <typeAlias type="net.crm.bill.model.BillFile" alias="BillFile" /> <typeAlias type="net.crm.salesmanage.model.CustomerInfo" alias="CustomerInfo" /> <typeAlias type="net.crm.sys.model.Department" alias="Department" /> <typeAlias type="net.crm.sys.model.WebjobLog" alias="WebjobLog" /> <typeAlias type="net.crm.salesmanage.model.EmployeeWork" alias="EmployeeWork" /> <typeAlias type="net.crm.user.model.UserInfo" alias="UserInfo" /> </typeAliases> <!-- 别名 <typeAliases> <typeAlias type="com.asgard.bms.business.model.Person" alias="PersonAlias"/> </typeAliases> --> <!-- 指定数据库分页方言Dialect, 其它方言:OracleDialect,SQLServerDialect,SybaseDialect,DB2Dialect,PostgreSQLDialect,MySQLDialect,DerbyDialect <plugins> <plugin interceptor="com.asgard.cfap.plugin.dialect.interceptor.OffsetLimitInterceptor"> <property name="dialectClass" value="com.asgard.cfap.plugin.dialect.MySQLDialect"/> </plugin> </plugins> <mappers> <mapper resource="com.asgard.bms.business.mapper.PersonMapper.xml"/> </mappers> --> </configuration>
第二种
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 类型别名 --> <typeAliases> <typeAlias alias="User" type="com.jieyou.login_register.po.User" /> <typeAlias alias="Admin" type="com.jieyou.login_register.po.Admin" /> </typeAliases> <!-- 列出映射文件 --> <mappers> <mapper resource="com/jieyou/login_register/dao/mapping/UserMapper.xml" /> <mapper resource="com/jieyou/login_register/dao/mapping/AdminMapper.xml" /> </mappers> </configuration>